package chen.web.controller.forum.model;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import chen.web.config.ConfigRepository;
import chen.web.config.SiteConfig;
import chen.web.favorite.Showable;
import chen.web.forum.Category;
import chen.web.forum.Reply;
import chen.web.forum.Subject;
import chen.web.forum.TopicInfo;

@Component
public class URL {
	
/*	@Autowired
	private Showable[] showableArray;
	*/
	public String getBase(){
		return ConfigRepository.instance().get(SiteConfig.class).getBaseURL();
	}
	
	public String category(Category category){
		return getBase() + category.getPath();
	}
	
	public String voteCategory(Category category){
		return getBase() + category.getPath() + "/vote";
	}
	
	public String digestCategory(Category category){
		return getBase() + category.getPath() + "/digest";
	}
	
	/*	public String topic(Subject subject){
		return getUrl(subject);
	}
	
	public String topic(TopicInfo info){
		return getUrl(info);
	}
	
	public String reply(Reply reply){
		return getUrl(reply);
	}
	
	
	private String getUrl(Object obj){
		for(Showable showable : showableArray){
			if(showable.support(obj)){
				return showable.showURL(obj);
			}
		}
		return null;
	}*/
	
}
